<template>
	<view class="con">
		<!-- 页面标题 start -->
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="content">通知公告</block>
		</cu-custom>
		<!-- 页面标题 end -->
		<!-- 搜索框 start -->
		<u-search @search="initData" v-model="title"></u-search>
		<!-- 搜索框 end -->
		<!-- 滑动翻页列表 start -->
		<uNotices @scrolltolower="scrolltolower" v-model="newsList"></uNotices>
		<!-- 滑动翻页列表 end -->
	</view>
</template>

<script>
	import newMixin from '@/common/request/newMixin'
	export default {
		mixins: [newMixin],
		created() {
			this.initData()
		},
		data() {
			return {
				newsList: [],
				page: {
					pageSize: 20,
					pageNo: 1
				},
				title: "",
			}
		},
		methods: {
			/**
			 * 初始化数据
			 */
			initData() {
				const pd = {
					pageSize: this.page.pageSize,
					pageNo: this.page.pageNo,
					title: "*" + this.title + "*"
				}
				this.getNews(pd, (data) => {
					this.newsList = data.records
					this.total = data.total
				})
			},
			/**
			 * 滑到底部
			 * @param {Object} event
			 * @param {Object} event1
			 */
			scrolltolower(event, event1) {
				this.page.pageNo += 1
				const pd = {
					pageSize: this.page.pageSize,
					pageNo: this.page.pageNo,
					title: "*" + this.title + "*"
				}
				this.getNews(pd, (data) => {
					this.newsList = this.newsList.concat(data.records)
				})
			},

		},
	}
</script>

<style lang="less" scoped>
	.con {}
</style>
